using System;
using System.Collections.Generic;
using System.Text;
using Slaks.Graphs.GraphBuilder;

namespace Slaks.Graphs.Algorithms.DistanceAlgorithm
{
    public class DistMCS4VertexEdgeFrequency : GraphDistanceBase
    {
        public DistMCS4VertexEdgeFrequency() : base ()
        {
			IsVisible = false;
        }

        public DistMCS4VertexEdgeFrequency(Graph one, Graph two)
            : base(one, two)
        {
			IsVisible = false;
        }
		public override bool CanOperateOnRepresentation (BuilderType builderType)
		{
			
			switch(builderType)
			{
				case BuilderType.StandardSimpleRepresentationSlaks:		
			case BuilderType.RawFrequencyRepresentationSlaks:
			case BuilderType.RawFrequencyRepresentationSchenker:
			case BuilderType.NormalizedFrequencyRepresentationSlaks:
			case BuilderType.NormalizedFrequencyRepresentationSchenker:
			case BuilderType.NormalizedFrequencyUniformRepresentationSlaks:
			case BuilderType.RawFrequencyUniformRepresentationSlaks:
			case BuilderType.StandardBiderectionalRepresentationSlaks:
			case BuilderType.NDistanceBiderectionalRepresentationSlaks:
			case BuilderType.StandardDictionaryRepresentationSchenker:
			case BuilderType.SimpleDictionaryRepresentationSchenker:
			case BuilderType.NDistanceDictionaryRepresentationSchenker:
			case BuilderType.NSimpleDistanceDictionaryRepresentationSchenker:
			case BuilderType.RawFrequencyDictionaryRepresentationSchenker:
			case BuilderType.NormalizedFrequencyDictionaryRepresentationSchenker:
			case BuilderType.WordnetStandardRepresentation:
			case BuilderType.WordnetRawFrequencyRepresentation:
			case BuilderType.WordnetNormalizedFrequencyRepresentation:
			case BuilderType.WordnetSynStandardRepresentation:
			case BuilderType.StandardSentenceWeightRepresentationSlaks:
			case BuilderType.NormalizedFrequencySentenceWeightRepresentationSlaks:
			case BuilderType.StandardTFIDFRepresentationSlaks:
				return true;
				
			}
                return false;        
                  
		}
        public override double GetDistance()
        {
            double maxCommonSubgraphSize = one.GetMCS(two).GetGraphSizeVertexEdgeFrequency;
            double graphSizeOne = one.GetGraphSizeVertexEdgeFrequency;
            double graphSizeTwo = two.GetGraphSizeVertexEdgeFrequency;
            if (maxCommonSubgraphSize == 0.0) return 1;
            return 1 - maxCommonSubgraphSize / Math.Max(graphSizeOne, graphSizeTwo);
        }
    }
}
